/*
 * Copyright (c) 2022 上海市政工程设计研究总院(集团)有限公司 All Rights Reserved.
 */
package com.smedi.ismedi.authoritymanagement.core.port.adapter.convert;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smedi.ismedi.authority.starter.response.AuthorityAccessResponse;
import com.smedi.ismedi.authoritymanagement.api.dto.request.*;
import com.smedi.ismedi.authoritymanagement.api.dto.response.ElementNodeResponse;
import com.smedi.ismedi.authoritymanagement.api.dto.response.ElementResponse;
import com.smedi.ismedi.authoritymanagement.api.dto.response.RoleAssignmentResponse;
import com.smedi.ismedi.authoritymanagement.api.dto.response.RoleResponse;
import com.smedi.ismedi.authoritymanagement.core.application.command.*;
import com.smedi.ismedi.authoritymanagement.core.application.query.vo.CurrentUserInfoVo;
import com.smedi.ismedi.authoritymanagement.core.domain.aggregatemodel.*;
import com.smedi.ismedi.authoritymanagement.core.port.adapter.persistence.model.ElementEntity;
import com.smedi.ismedi.authoritymanagement.core.port.adapter.persistence.model.RoleBasicEntity;
import com.smedi.ismedi.authoritymanagement.core.port.adapter.persistence.model.RoleMemberEntity;
import com.smedi.ismedi.web.starter.common.PaginationData;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;

import java.util.List;

/**
 * AdapterConverter
 *
 * @author 15428
 * &#064;date  2022-06-07 15:22:03
 * @since 0.0.1
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface AdapterConverter {

    RoleListQueryCommand roleListQueryRequestToRoleListQueryCommand(RoleListQueryRequest roleListQueryRequest);

    List<Role> roleBasicEntityToRole(List<RoleBasicEntity> roleBasicEntities);

    @Mapping(source = "roleName", target = "name")
    Role roleBasicEntityToRole(RoleBasicEntity roleBasicEntities);

    List<RoleResponse> roleToRoleResponse(List<Role> roles);

    RoleAssignmentListQueryCommand roleAssignmentListQueryRequestToRoleAssignmentListQueryCommand(RoleAssignmentListQueryRequest roleAssignmentListQueryRequest);

    List<RoleAssignmentResponse> roleAssignmentToRoleAssignmentResponse(List<RoleAssignment> roleAssignments);

    RoleAssignmentResponse roleAssignmentToRoleAssignmentResponse(RoleAssignment roleAssignment);

    RoleAssignment roleMemberEntityToRoleAssignment(RoleMemberEntity roleMemberEntity);

    List<RoleAssignment> roleMemberEntityToRoleAssignment(List<RoleMemberEntity> roleMemberEntities);

    ElementCreateCommand elementCreateRequestToElementCreateCommand(ElementCreateRequest elementCreateRequest);

    ElementResponse elementToElementResponse(Element element);

    List<ElementResponse> elementToElementResponse(List<Element> elements);

    PaginationData<ElementResponse> elementToElementResponse(Page<Element> elements);

    ElementEntity elementToElementEntity(Element element);

    Element elementEntityToElement(ElementEntity elementEntity);

    List<Element> elementEntityToElement(List<ElementEntity> elementEntities);

    ElementEditCommand elementEditRequestToElementCreateCommand(ElementEditRequest elementEditRequest);

    List<ElementEditCommand> elementEditRequestToElementCreateCommand(List<ElementEditRequest> elementEditRequests);

    ElementRemoveCommand elementRemoveRequestToElementRemoveCommand(ElementRemoveRequest elementRemoveRequest);

    ElementOneQuery elementOneRequestToElementOneQuery(ElementOneRequest elementOneRequest);

    ElementListQuery elementListRequestToElementListQuery(ElementListRequest elementListRequest);

    ElementPageQuery elementPageRequestToElementPageQuery(ElementPageRequest elementPageRequest);

    ElementNodeResponse nodeToNodeResponse(ElementNode elementNode);

    List<ElementNodeResponse> nodeToNodeResponse(List<ElementNode> elementNodes);

    Page<Element> elementEntityPageToElementPage(Page<ElementEntity> elementEntityPage);

    ElementTreeCommand elementTreeRequestToElementTreeCommand(ElementTreeRequest elementTreeRequest);

    RoleElementRelationshipSaveCommand roleElementRelationshipSaveRequestToRoleElementRelationshipSaveCommand(RoleElementRelationshipSaveRequest roleElementRelationshipSaveRequest);

    AuthorityAccessResponse authorityAccessToAuthorityAccessResponse(AuthorityAccess authorityAccess);

    AuthorityAccessResponse currentUserInfoVoToAuthorityAccessResponse(CurrentUserInfoVo currentUserInfoVo);
}
